
//
//  PresentDetailsCollectionViewCell.m
//  BeautifulShoppings
//
//  Created by GivenBmli on 16/9/5.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "PresentDetailsCollectionViewCell.h"
#import "PresentDetailsModel.h"
#import "UIImageView+WebCache.h"
#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height
@implementation PresentDetailsCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self  = [super initWithFrame:frame];
    if (self) {
        [self creatSubview:frame];
        
    }
    
    return self;
}

- (void)setPresentDetailsModel:(PresentDetailsModel *)presentDetailsModel{
    self.favorites_count.text = [NSString stringWithFormat:@"%ld",(long)presentDetailsModel.favorites_count];
    
    [self.cover_image_url sd_setImageWithURL:[NSURL URLWithString:presentDetailsModel.cover_image_url] placeholderImage:[UIImage imageNamed:@"站位"]];
    self.name.text = presentDetailsModel.name;
    self.price.text = presentDetailsModel.price;
}
- (void)creatSubview:(CGRect)frame{
    self.cover_image_url = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH ,HEIGHT/3*2)];
    [self.contentView addSubview:self.cover_image_url];
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/10, HEIGHT/3 *2.1, WIDTH - WIDTH/10, HEIGHT - HEIGHT/3 *2.5 )];
    self.name.numberOfLines = NO;
    [self.contentView addSubview:self.name];
    self.price = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 20, HEIGHT / 10 *9, WIDTH , HEIGHT /10  )];
//    self.price.textColor = [UIColor redColor];
    [self.contentView addSubview:self.price];
    UIView *viewDown = [[UIView alloc]initWithFrame:CGRectMake(0,HEIGHT-1, WIDTH, 1)];
//    viewDown.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewDown];
    UIView *viewLeft = [[UIView alloc]initWithFrame:CGRectMake(0,0, 1, HEIGHT)];
//    viewLeft.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewLeft];
    UIView *viewRight = [[UIView alloc]initWithFrame:CGRectMake(WIDTH-1,0, 1, HEIGHT)];
//    viewRight.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewRight];
}

@end
